package com.zhangxx.web.common.config;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

import javax.sql.DataSource;

@Configuration
public class DataSourceConfig {

	@Bean(name="dataSource")
	@Qualifier("dataSource")
	@ConfigurationProperties(prefix="spring.datasource.hikari")
	@Primary
	public DataSource getDateSource(){
		System.out.println("dataSource创建");
		return DataSourceBuilder.create().build();
	}


}
